/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package carcassonne.initialize;

import org.w3c.dom.Element;
import org.w3c.dom.NodeList;

/**
 *
 * @author tylerb
 */
public class XmlParser {
    
    public static String getIdValue(Element el) {
        return el.getAttribute("id");
    }

    public static int getIntValue(Element el, String tagName) {
        return Integer.parseInt(getTextValue(el,tagName));
    }

    public static String getTextValue(Element el, String tagName) {
        String textVal = null;
	NodeList nl = el.getElementsByTagName(tagName);
	if(nl != null && nl.getLength() > 0) {
		Element e = (Element)nl.item(0);
		textVal = e.getFirstChild().getNodeValue();
	}

	return textVal;
    }

}
